package com.common.weibolib;

import android.content.Context;

import com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.assist.ImageLoadingListener;
import com.nostra13.universalimageloader.utils.StorageUtils;
import com.product.android.business.ApplicationVariable;
import com.product.android.ui.anim.AnimateFirstDisplayListener;
import com.starappallcommon.R;

public class GlobalSetting {	
	public static final int WIFI_HEIGHT = 1024;
	public static final int WIFI_WIDTH = 1920;
	public static final int NO_WIFI_HEIGHT = 600;
	public static final int NO_WIFI_WIDTH = 640;
	public static final int COMPRESS_QUALITY = 80; //微博图片 压缩率改成 80，  by dyf 20140119
	public static final long RANK_WEIBO_ID = 1111222201;
	
	private static String WEIBO_DISC_CACHE_DIR = "weibo";
	private static int DISC_CACHE_SIZE_128MB = 134217728;//128 * 1024 * 1024;
	private static DisplayImageOptions mWeiboCacheOptions = null;
	private static DisplayImageOptions mWeiboNoCacheOptions = null;
	private static ImageLoadingListener mAnimateFirstListener = null;
	
	//是否需要抽奖功能
	public static boolean gIsNeedLottery = true;
	
	/**
	 * 
	 * @n<b>函数名称</b>     :getMxTagId
	 * @brief	获取明星id
	 * @see
	 * @since    Ver 1.1
	 * @param  @return
	 * @return int
	 * @<b>作者</b>          :  huangszh
	 * @<b>创建时间</b>      :  2014-4-4上午10:56:59
	 */
	public static int getMxTagId(){
		return 777;
	}
	
	//全局鲜花数
	public static int flowerNum = 0;
	//校友那边用来刷新个人主页的积分
	public static boolean mMyTweetRefresh = false;
	//默认的新浪微博分组名称
	public static String defaultGroupName="";
	public static String getSid(Context context){
		return ApplicationVariable.INSTANCE.getSid();
	}
	
	public static long getUid(){
		return ApplicationVariable.INSTANCE.getOapUid();
	}
	
	public static DisplayImageOptions getWeiboCacheOpt(Context ctx){
		if(mWeiboCacheOptions == null){
			mWeiboCacheOptions = new DisplayImageOptions.Builder()
			.showStubImage(R.drawable.image_bg)
			.showImageForEmptyUri(R.drawable.image_bg)
			.showImageOnFail(R.drawable.image_bg)
			.cacheInMemory()
			.cacheOnDisc()
			.discCache(
					new TotalSizeLimitedDiscCache(StorageUtils
							.getIndividualCacheDirectory(ctx,
									WEIBO_DISC_CACHE_DIR),
							DISC_CACHE_SIZE_128MB)).build();
		}
		return mWeiboCacheOptions;
	}
	
    public static DisplayImageOptions getWeiboNoCacheOpt(Context ctx){
    	if(mWeiboNoCacheOptions == null){
    		mWeiboNoCacheOptions = new DisplayImageOptions.Builder()
			.showThumbImage(true)
			.cacheOnDisc()
			.discCache(
					new TotalSizeLimitedDiscCache(StorageUtils
							.getIndividualCacheDirectory(ctx,
									WEIBO_DISC_CACHE_DIR),
							DISC_CACHE_SIZE_128MB)).build();
    	}
		return mWeiboNoCacheOptions;
	}
    
    public static ImageLoadingListener getImageLoadingListener(){
    	if(mAnimateFirstListener == null){
    		mAnimateFirstListener = new AnimateFirstDisplayListener();
    	}
    	return mAnimateFirstListener;
    }
    
}
